//一维数组数组去重，要求：在原型链上添加函数
//
if(!Array.prototype.lyUnique) {
    Array.prototype.lyUnique = function () {
        var hash = {}
        var result = []
        var len = this.length
        var arr = this

        for (var i = 0; i < len; i++) {
            if (!hash[arr[i]+typeof arr[i]]) {// 处理1 和 '1'
                hash[arr[i]+typeof arr[i]] = true
                result.push(arr[i])
            }
        }
        return result
    }
}

var arr = [1,1,2,2,3,3,'1','2']
var arr2 = ['a','a','b','c']


console.log(arr.lyUnique()) // [ 1, 2, 3, '1', '2' ]
console.log('原数组arr不变',arr)
console.log(arr2.lyUnique()) // [ 'a', 'b', 'c' ]



// console.log(Object.prototype.toString.call(1));
// console.log(Object.prototype.toString.call('1'));
// console.log(typeof  '1');
// console.log(typeof  []);
